package com.clc.controller.user;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.clc.bean.Users;
import com.clc.service.IUserService;

@Controller
@RequestMapping("/userManager")
public class UserManagerController {
	static Log log = LogFactory.getLog(UserManagerController.class.getName());
	@Autowired
	private IUserService userService;
	
	
	@RequestMapping(value="/init.do")
    public ModelAndView excuteAction(HttpServletRequest request, HttpServletResponse response)  
    		 throws Exception {
		List<Users> users = userService.findUserList();
		log.info(users.size());
		ModelAndView medelView = new ModelAndView("userManager/userManage");
		Map modelMap = new HashMap();  
		modelMap.put("users", users);  
		medelView.addAllObjects(modelMap);
		return medelView;
    } 
	
}
